/***************************************************************************
 *   Copyleft 2006-2007 by												   *
 *	 Iwanicki Krzysztof													   *
 *   <gamma.mini.pw.edu.pl/~iwanickik>			                           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 ***************************************************************************/
#ifndef __RENDERER_H__
#define __RENDERER_H__

#include <windows.h>
#include <math.h>
#include "../../Types/Types.h"
#include "../Math/Math.h"

#define WORLD_WIDTH		4.0f
#define WORLD_HEIGHT	3.0f

class Renderer {
private:
	HWND mhWnd;
	HDC mhMemDC;
	HBITMAP mhMemBmp;
	HBITMAP mhOldMemBmp;
	cInt mWidth;
	cInt mHeight;
	cBool mClear;
	cInt mAdaptiveStep;

	cVoid DrawRectangle(cInt beginPointX, cInt beginPointY, cInt xWidth, cInt yHeight, cWinColor color);
public:
	/**************************************************************
    * Constructors                                                *
    ***************************************************************/
	Renderer();
	Renderer(const Renderer& renderer);
	~Renderer();

	/**************************************************************
    * Operators                                                   *
    ***************************************************************/


    /**************************************************************
    * Other helpful functions                                     *
    ***************************************************************/
	cVoid Init(HWND windowHandle);
	cVoid Render(HDC hdc, cRect rect);
	cVoid Render();
	cVoid Refresh();
	cVoid Clear();
	cVoid Resize();
	cInt GetWidth();
	cInt GetHeight();
	cInt GetAdaptiveStep();
	cVoid ResetAdaptiveStep();
	cVoid IncreaseAdaptive();
	cVoid StopAdaptive();

	cVoid SetPixel(cInt iX, cInt iY, cWinColor color);
	cVoid DrawRectangle(cInt beginPointX, cInt beginPointY, cInt xWidth, cInt yHeight, 
		cWinColor color, cBool bFill);
	cVoid DrawLine(cInt beginPointX, cInt beginPointY, cInt endPointX, cInt endPointY, cWinColor color);
	cVoid DrawLine(const Point4D& p1, const Point4D& p2, const cWinColor color);
	cVoid DrawROPLine(cInt beginPointX, cInt beginPointY, cInt endPointX, cInt endPointY, cWinColor color);
	cVoid DrawROPLine(const Point4D& p1, const Point4D& p2, const cWinColor color);
	cVoid DrawString(cInt iX, cInt iY, const cChar *text, 
		cBool bBold, cBool bLeftAligned, cBool bTopAligned, cWinColor color = RGB(255, 255, 255));
	cVoid SetClear(cBool bClear);
	cVoid DrawPoint(const Point4D& p1, const cWinColor color, cShort sMarked);
};

#endif